﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FrameWorkCore
{
    public interface IUnitOfWork
    {
        public bool DisableFilter();

        public IDisposable IgnoreQueryFilters(bool Ignore = false);
    }

    public class UnitOfWork : IUnitOfWork, IDisposable
    {
        private bool _IgnoreQueryFilters = false;

        public bool DisableFilter()
            => _IgnoreQueryFilters;


        public void Dispose()
            => _IgnoreQueryFilters = false;

        public IDisposable IgnoreQueryFilters(bool Ignore = false)
        {
            _IgnoreQueryFilters = Ignore;

            return this;
        }
    }
}
